package com.jiayang.business.stationpage;

import com.jiayang.business.stationpage.domain.dto.EquipmentQueryDTO;
import com.jiayang.common.anno.OperateLog;
import com.jiayang.common.domain.ResponseDTO;
import com.jiayang.constant.SwaggerTagConst;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @ Author     ：OuyangChenglong
 * @ Date       ：Created in 9:56 2021/9/8
 * @ Description：场站首页相关API
 * @ Modified By：
 * @Version: 1.0$
 */
@RestController
@Api(tags = {SwaggerTagConst.Admin.CLIENT_STATION_PAGE})
@OperateLog
public class StationPageController {

    @Autowired
    private StationPageService stationPageService;

    @GetMapping("/stationPage/initGetStationMapInfo/{sid}")
    @ApiOperation(value = "根据场站id获取当前场站的地图信息和所有可用设备坐标", notes = "前端传递一个场站id @author OuyangChenglong")
    public ResponseDTO initGetStationAndEquipment(@PathVariable String sid) {
        return stationPageService.getStationAndEquipment(sid);
    }

    // -----------运行概况----------------------------------
    @GetMapping("/stationPage/initGetEquipmentState/{sid}")
    @ApiOperation(value = "根据场站id获取当前场站的设备运行情况", notes = "设备运行概况饼状图 @author OuyangChenglong")
    public ResponseDTO initGetEquipmentState(@PathVariable String sid) {
        return stationPageService.getEquipmentState(sid);
    }

    @GetMapping("/stationPage/initGetSensorState/{sid}")
    @ApiOperation(value = "根据场站id获取当前场站的传感器运行情况", notes = "传感器运行概况饼状图 @author OuyangChenglong")
    public ResponseDTO initGetSensorState(@PathVariable String sid) {
        return stationPageService.getSensorState(sid);
    }

    @GetMapping("/stationPage/initGetInfraredState/{sid}")
    @ApiOperation(value = "根据场站id获取当前场站的红外摄像头运行情况", notes = "红外运行概况饼状图 @author OuyangChenglong")
    public ResponseDTO initGetInfraredState(@PathVariable String sid) {
        return stationPageService.getInfraredState(sid);
    }

    @GetMapping("/stationPage/initGetOilState/{sid}")
    @ApiOperation(value = "根据场站id获取当前场站的油液传感器运行情况", notes = "油液传感器运行概况饼状图 @author OuyangChenglong")
    public ResponseDTO initGetOilState(@PathVariable String sid) {
        return stationPageService.getOilState(sid);
    }

    @GetMapping("/stationPage/getAllEquipment/{sid}")
    @ApiOperation(value = "根据场站id获取当前场站设备列表", notes = "设备列表 @author OuyangChenglong")
    public ResponseDTO getAllEquipment(@PathVariable String sid) {
        return stationPageService.getAllEquipment(sid);
    }

    @PostMapping("/stationPage/getAllEquipment/query/{sid}")
    @ApiOperation(value = "根据场站id获取当前场站设备列表", notes = "设备列表 @author OuyangChenglong")
    public ResponseDTO getAllEquipment(@Valid @RequestBody EquipmentQueryDTO equipmentQuery,@PathVariable String sid) {
        return stationPageService.getEquipmentByQuery(sid,equipmentQuery);
    }

}
